package com.netease.pris.activity.view;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;

public class NPullToRefreshListView extends ListView
  implements AbsListView.OnScrollListener
{
  private static final String a = "PullToRefreshListView";
  private static final int b = 1;
  private static final int c = 2;
  private static final int d = 3;
  private static final int e = 4;
  private j f;
  private AbsListView.OnScrollListener g;
  private LayoutInflater h;
  private LinearLayout i;
  private TextView j;
  private ImageView k;
  private ProgressBar l;
  private TextView m;
  private int n = 0;
  private int o;
  private RotateAnimation p;
  private RotateAnimation q;
  private int r;
  private int s;
  private int t;
  private int u;
  private final int v = 20;
  private bk w;
  private boolean x;

  public NPullToRefreshListView(Context paramContext)
  {
    super(paramContext);
    a(paramContext);
  }

  public NPullToRefreshListView(Context paramContext, AttributeSet paramAttributeSet)
  {
    super(paramContext, paramAttributeSet);
    a(paramContext);
  }

  public NPullToRefreshListView(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
  {
    super(paramContext, paramAttributeSet, paramInt);
    a(paramContext);
  }

  private void a(Context paramContext)
  {
    this.w = new bk(this);
    this.p = new RotateAnimation(0.0F, -180.0F, 1, 0.5F, 1, 0.5F);
    this.p.setInterpolator(new LinearInterpolator());
    this.p.setDuration(250L);
    this.p.setFillAfter(true);
    this.q = new RotateAnimation(-180.0F, 0.0F, 1, 0.5F, 1, 0.5F);
    this.q.setInterpolator(new LinearInterpolator());
    this.q.setDuration(250L);
    this.q.setFillAfter(true);
    this.h = ((LayoutInflater)paramContext.getSystemService("layout_inflater"));
    this.i = ((LinearLayout)this.h.inflate(2130903062, null));
    this.j = ((TextView)this.i.findViewById(2131558464));
    this.k = ((ImageView)this.i.findViewById(2131558463));
    this.l = ((ProgressBar)this.i.findViewById(2131558462));
    this.m = ((TextView)this.i.findViewById(2131558465));
    this.k.setMinimumHeight(50);
    this.i.setOnClickListener(new aq(this, null));
    this.s = this.i.getPaddingTop();
    this.o = 1;
    addHeaderView(this.i);
    super.setOnScrollListener(this);
    this.u = 20;
    setSelection(1);
  }

  private void a(MotionEvent paramMotionEvent)
  {
    if (this.x);
    while (true)
    {
      return;
      int i1 = getFirstVisiblePosition();
      Log.v("handleMove", "mCurrentScrollState == " + this.n + " mRefreshState== " + this.o + " firstVisibleItem: " + i1);
      if ((this.n != 1) || (this.o == 4))
        continue;
      if (i1 == 0)
      {
        this.k.setVisibility(0);
        if (((this.i.getBottom() >= this.r + this.u) || (this.i.getTop() >= 0)) && (this.o != 3))
        {
          this.j.setText(2131362299);
          this.k.clearAnimation();
          this.k.startAnimation(this.p);
          this.o = 3;
          continue;
        }
        if ((this.i.getBottom() >= this.r + this.u) || (this.o == 2))
          continue;
        this.j.setText(2131362300);
        if (this.o != 1)
        {
          this.k.clearAnimation();
          this.k.startAnimation(this.q);
        }
        this.o = 2;
        continue;
      }
      this.k.setVisibility(8);
      i();
    }
  }

  // ERROR //
  private void b(MotionEvent paramMotionEvent)
  {
    // Byte code:
    //   0: iconst_1
    //   1: istore_2
    //   2: aload_1
    //   3: invokevirtual 254	android/view/MotionEvent:getHistorySize	()I
    //   6: istore_3
    //   7: iconst_2
    //   8: anewarray 256	java/lang/Object
    //   11: astore 4
    //   13: aload 4
    //   15: iconst_0
    //   16: aload_0
    //   17: getfield 54	com/netease/pris/activity/view/NPullToRefreshListView:n	I
    //   20: invokestatic 262	java/lang/Integer:valueOf	(I)Ljava/lang/Integer;
    //   23: aastore
    //   24: aload 4
    //   26: iload_2
    //   27: aload_0
    //   28: getfield 168	com/netease/pris/activity/view/NPullToRefreshListView:o	I
    //   31: invokestatic 262	java/lang/Integer:valueOf	(I)Ljava/lang/Integer;
    //   34: aastore
    //   35: ldc 10
    //   37: ldc_w 264
    //   40: aload 4
    //   42: invokestatic 270	java/lang/String:format	(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    //   45: invokestatic 272	android/util/Log:d	(Ljava/lang/String;Ljava/lang/String;)I
    //   48: pop
    //   49: ldc 251
    //   51: ldc_w 274
    //   54: iconst_0
    //   55: anewarray 276	java/lang/Class
    //   58: invokevirtual 280	java/lang/Class:getMethod	(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
    //   61: aload_1
    //   62: iconst_0
    //   63: anewarray 256	java/lang/Object
    //   66: invokevirtual 286	java/lang/reflect/Method:invoke	(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
    //   69: checkcast 258	java/lang/Integer
    //   72: invokevirtual 289	java/lang/Integer:intValue	()I
    //   75: istore 22
    //   77: iload 22
    //   79: istore_2
    //   80: iconst_0
    //   81: istore 7
    //   83: iload 7
    //   85: iload_3
    //   86: if_icmpge +328 -> 414
    //   89: iconst_0
    //   90: istore 8
    //   92: iload 8
    //   94: iload_2
    //   95: if_icmpge +313 -> 408
    //   98: aload_0
    //   99: getfield 168	com/netease/pris/activity/view/NPullToRefreshListView:o	I
    //   102: iconst_3
    //   103: if_icmpne +141 -> 244
    //   106: aload_0
    //   107: invokevirtual 293	com/netease/pris/activity/view/NPullToRefreshListView:isVerticalFadingEdgeEnabled	()Z
    //   110: ifeq +8 -> 118
    //   113: aload_0
    //   114: iconst_0
    //   115: invokevirtual 296	com/netease/pris/activity/view/NPullToRefreshListView:setVerticalScrollBarEnabled	(Z)V
    //   118: iconst_2
    //   119: anewarray 276	java/lang/Class
    //   122: astore 15
    //   124: aload 15
    //   126: iconst_0
    //   127: getstatic 300	java/lang/Integer:TYPE	Ljava/lang/Class;
    //   130: aastore
    //   131: aload 15
    //   133: iconst_1
    //   134: getstatic 300	java/lang/Integer:TYPE	Ljava/lang/Class;
    //   137: aastore
    //   138: ldc 251
    //   140: ldc_w 302
    //   143: aload 15
    //   145: invokevirtual 280	java/lang/Class:getMethod	(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
    //   148: astore 16
    //   150: iconst_2
    //   151: anewarray 256	java/lang/Object
    //   154: astore 17
    //   156: aload 17
    //   158: iconst_0
    //   159: iload 8
    //   161: invokestatic 262	java/lang/Integer:valueOf	(I)Ljava/lang/Integer;
    //   164: aastore
    //   165: aload 17
    //   167: iconst_1
    //   168: iload 7
    //   170: invokestatic 262	java/lang/Integer:valueOf	(I)Ljava/lang/Integer;
    //   173: aastore
    //   174: aload 16
    //   176: aload_1
    //   177: aload 17
    //   179: invokevirtual 286	java/lang/reflect/Method:invoke	(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
    //   182: checkcast 304	java/lang/Float
    //   185: invokevirtual 305	java/lang/Float:intValue	()I
    //   188: istore 18
    //   190: iload 18
    //   192: istore 10
    //   194: iload 10
    //   196: aload_0
    //   197: getfield 307	com/netease/pris/activity/view/NPullToRefreshListView:t	I
    //   200: isub
    //   201: aload_0
    //   202: getfield 222	com/netease/pris/activity/view/NPullToRefreshListView:r	I
    //   205: isub
    //   206: i2d
    //   207: ldc2_w 308
    //   210: ddiv
    //   211: d2i
    //   212: istore 11
    //   214: aload_0
    //   215: getfield 125	com/netease/pris/activity/view/NPullToRefreshListView:i	Landroid/widget/LinearLayout;
    //   218: aload_0
    //   219: getfield 125	com/netease/pris/activity/view/NPullToRefreshListView:i	Landroid/widget/LinearLayout;
    //   222: invokevirtual 312	android/widget/LinearLayout:getPaddingLeft	()I
    //   225: iload 11
    //   227: aload_0
    //   228: getfield 125	com/netease/pris/activity/view/NPullToRefreshListView:i	Landroid/widget/LinearLayout;
    //   231: invokevirtual 315	android/widget/LinearLayout:getPaddingRight	()I
    //   234: aload_0
    //   235: getfield 125	com/netease/pris/activity/view/NPullToRefreshListView:i	Landroid/widget/LinearLayout;
    //   238: invokevirtual 318	android/widget/LinearLayout:getPaddingBottom	()I
    //   241: invokevirtual 322	android/widget/LinearLayout:setPadding	(IIII)V
    //   244: iinc 8 1
    //   247: goto -155 -> 92
    //   250: astore 21
    //   252: aload 21
    //   254: athrow
    //   255: astore 20
    //   257: getstatic 328	java/lang/System:err	Ljava/io/PrintStream;
    //   260: new 191	java/lang/StringBuilder
    //   263: dup
    //   264: invokespecial 192	java/lang/StringBuilder:<init>	()V
    //   267: ldc_w 330
    //   270: invokevirtual 198	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   273: aload 20
    //   275: invokevirtual 333	java/lang/StringBuilder:append	(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    //   278: invokevirtual 209	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   281: invokevirtual 339	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   284: goto -204 -> 80
    //   287: astore 19
    //   289: getstatic 328	java/lang/System:err	Ljava/io/PrintStream;
    //   292: new 191	java/lang/StringBuilder
    //   295: dup
    //   296: invokespecial 192	java/lang/StringBuilder:<init>	()V
    //   299: ldc_w 330
    //   302: invokevirtual 198	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   305: aload 19
    //   307: invokevirtual 333	java/lang/StringBuilder:append	(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    //   310: invokevirtual 209	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   313: invokevirtual 339	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   316: goto -236 -> 80
    //   319: astore 14
    //   321: aload_1
    //   322: iload 7
    //   324: invokevirtual 342	android/view/MotionEvent:getHistoricalY	(I)F
    //   327: f2i
    //   328: istore 10
    //   330: goto -136 -> 194
    //   333: astore 13
    //   335: aload 13
    //   337: athrow
    //   338: astore 12
    //   340: getstatic 328	java/lang/System:err	Ljava/io/PrintStream;
    //   343: new 191	java/lang/StringBuilder
    //   346: dup
    //   347: invokespecial 192	java/lang/StringBuilder:<init>	()V
    //   350: ldc_w 330
    //   353: invokevirtual 198	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   356: aload 12
    //   358: invokevirtual 333	java/lang/StringBuilder:append	(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    //   361: invokevirtual 209	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   364: invokevirtual 339	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   367: iconst_0
    //   368: istore 10
    //   370: goto -176 -> 194
    //   373: astore 9
    //   375: getstatic 328	java/lang/System:err	Ljava/io/PrintStream;
    //   378: new 191	java/lang/StringBuilder
    //   381: dup
    //   382: invokespecial 192	java/lang/StringBuilder:<init>	()V
    //   385: ldc_w 330
    //   388: invokevirtual 198	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   391: aload 9
    //   393: invokevirtual 333	java/lang/StringBuilder:append	(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    //   396: invokevirtual 209	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   399: invokevirtual 339	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   402: iconst_0
    //   403: istore 10
    //   405: goto -211 -> 194
    //   408: iinc 7 1
    //   411: goto -328 -> 83
    //   414: return
    //   415: astore 6
    //   417: goto -337 -> 80
    //
    // Exception table:
    //   from	to	target	type
    //   49	77	250	java/lang/IllegalArgumentException
    //   49	77	255	java/lang/IllegalAccessException
    //   49	77	287	java/lang/reflect/InvocationTargetException
    //   118	190	319	java/lang/NoSuchMethodException
    //   118	190	333	java/lang/IllegalArgumentException
    //   118	190	338	java/lang/IllegalAccessException
    //   118	190	373	java/lang/reflect/InvocationTargetException
    //   49	77	415	java/lang/NoSuchMethodException
  }

  private void h()
  {
    Object[] arrayOfObject = new Object[2];
    arrayOfObject[0] = Integer.valueOf(this.n);
    arrayOfObject[1] = Integer.valueOf(this.o);
    Log.d("PullToRefreshListView", String.format("[resetHeaderPadding]currState=%d, refreshState=%d", arrayOfObject));
    this.i.setPadding(this.i.getPaddingLeft(), this.s, this.i.getPaddingRight(), this.i.getPaddingBottom());
  }

  private void i()
  {
    if (this.o != 1)
    {
      this.o = 1;
      h();
      this.j.setText(2131362302);
      this.j.setVisibility(0);
      this.k.setImageResource(2130837772);
      this.k.clearAnimation();
      this.k.setVisibility(8);
      this.l.setVisibility(8);
    }
  }

  public void a()
  {
    setHeaderDividersEnabled(false);
    this.i.setVisibility(8);
    setDivider(null);
  }

  public void a(int paramInt)
  {
    this.u = paramInt;
  }

  public void a(j paramj)
  {
    this.f = paramj;
  }

  public void a(String paramString)
  {
    if (paramString != null)
    {
      this.m.setVisibility(0);
      this.m.setText(paramString);
    }
    while (true)
    {
      return;
      this.m.setVisibility(4);
    }
  }

  public void b()
  {
    this.i.setVisibility(0);
    setHeaderDividersEnabled(true);
  }

  public void b(String paramString)
  {
    a(paramString);
    f();
  }

  public void c()
  {
    setSelection(-1);
    d();
    e();
  }

  public void d()
  {
    h();
    this.k.setVisibility(8);
    this.k.setImageDrawable(null);
    this.l.setVisibility(0);
    this.j.setText(2131362301);
    this.m.setVisibility(4);
    this.o = 4;
  }

  public void e()
  {
    if (this.f != null)
      this.f.a();
  }

  public void f()
  {
    i();
    if (this.i.getBottom() >= 0)
    {
      invalidateViews();
      setSelection(1);
    }
  }

  public void g()
  {
    i();
  }

  public int getSolidColor()
  {
    return super.getSolidColor();
  }

  protected void onAttachedToWindow()
  {
    super.onAttachedToWindow();
    Log.v("onAttachedTowindow", "onAttachedWindow is: running");
  }

  protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    super.onLayout(paramBoolean, paramInt1, paramInt2, paramInt3, paramInt4);
    Log.v("onLayout", "onLayout is ");
  }

  protected void onMeasure(int paramInt1, int paramInt2)
  {
    super.onMeasure(paramInt1, paramInt2);
    if (this.r <= 0)
      this.r = this.i.getMeasuredHeight();
  }

  public void onScroll(AbsListView paramAbsListView, int paramInt1, int paramInt2, int paramInt3)
  {
    if ((this.n == 2) && (paramInt1 == 0) && (this.o != 4))
      setSelection(1);
    if (this.g != null)
      this.g.onScroll(paramAbsListView, paramInt1, paramInt2, paramInt3);
  }

  public void onScrollStateChanged(AbsListView paramAbsListView, int paramInt)
  {
    this.n = paramInt;
    if (this.g != null)
      this.g.onScrollStateChanged(paramAbsListView, paramInt);
  }

  public boolean onTouchEvent(MotionEvent paramMotionEvent)
  {
    int i1 = 1;
    if (this.x)
      return i1;
    Log.v("ONTOUCHEVNET", "event.getAction() : " + paramMotionEvent.getAction());
    int i2 = (int)paramMotionEvent.getY();
    switch (0xFF & paramMotionEvent.getAction())
    {
    default:
    case 1:
    case 0:
    case 2:
    }
    while (true)
    {
      i1 = super.onTouchEvent(paramMotionEvent);
      break;
      if (!isVerticalScrollBarEnabled())
        setVerticalScrollBarEnabled(i1);
      if ((getFirstVisiblePosition() != 0) || (this.o == 4))
        continue;
      if (((this.i.getBottom() >= this.r + this.u) || (this.i.getTop() >= 0)) && (this.o == 3))
      {
        this.o = 4;
        d();
        e();
        continue;
      }
      if ((this.i.getBottom() >= this.r + this.u) && (this.i.getTop() > 0))
        continue;
      i();
      setSelection(i1);
      continue;
      this.t = i2;
      continue;
      a(paramMotionEvent);
      b(paramMotionEvent);
    }
  }

  public void setAdapter(ListAdapter paramListAdapter)
  {
    super.setAdapter(paramListAdapter);
    setSelection(1);
  }

  public void setOnScrollListener(AbsListView.OnScrollListener paramOnScrollListener)
  {
    this.g = paramOnScrollListener;
  }

  public void setSelection(int paramInt)
  {
    super.setSelection(paramInt);
    Log.v("NPULLTOREFRESHLISTVIEW", "slection: position " + paramInt);
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.activity.view.NPullToRefreshListView
 * JD-Core Version:    0.6.0
 */